/*
* ali led driver framework
* AUTHOR: chiliang.cl@alibaba-inc.com
*
*/

#ifndef __IS3729_H__
#define __IS3729_H__

#include <stdbool.h>
#include <aos/hal/i2c.h>

#ifdef __cplusplus
extern "C" {
#endif

#define IS3729_MAX_LED_LEN          144

#define IS3729_CHIP                         "is3729_chip"
#define IS3729_I2C_PORT                     1
#define IS3729_I2C_ADDR                     0x34
//#define IS3729_BUF_LEN                      85
#define IS3729_INIT_TRY_CNT                 1
#define IS3729_LOWEST_SEC_CS_PWM            1
#define IS3729_LOWEST_DRIVE_CS_PWM          12
#define IS3729_LOWEST_SEC_LATTICE_MAX_PWM   15
#define IS3729_LOWEST_SEC_LATTICE_MIN_PWM   5

#define IS3729_PWM_START_REG                0x01
#define IS3729_CS_SCALING_START_REG         0x90
#define IS3729_CONFIG_REG                   0xA0
#define IS3729_CLOBAL_CURRENT_REG           0xA1
#define IS3729_PULL_DOWNUP_REG              0xB0
#define IS3729_SPREAD_SPECTRUM_REG          0xB1
#define IS3729_PWM_FREQUENCY_REG            0xB2
#define IS3729_OPEN_SHORT_START_REG         0xB3
#define IS3729_RESET_REG                    0xCF

#define IS3729_CS_NUM                       16
#define IS3729_SW_NUM                       9
#define IS3729_BRIGHTNESS_VAL               23
#define IS3729_BRIGHTNESS_MAX_VAL           45
#define IS3729_BRIGHTNESS_DEF_VAL           0xff
#define IS3729_CONFIG_DEF_VAL               0x31
#define IS3729_CONFIG_INIT_VAL              0x00
#define IS3729_CONFIG_OPEN_TEST_VAL         0x03
#define IS3729_CONFIG_SHORT_TEST_VAL        0x05
#define IS3729_PWM_MAX_VAL                  0xff
#define IS3729_GCC_MAX_VAL                  0x40
#define IS3729_GCC_SELF_TEST                0x01
#define IS3729_GCC_SHUDOWN                  0x00
#define IS3729_PWM_29K_VAL                  0x01
#define IS3729_PULL_DOWNUP_DEF_VAL          0x03
#define IS3729_SPREAD_SPECTRUM_DEF_VAL      0x00
#define IS3729_RESET_VAL                    0xAE
#define IS3729_OPEN_SHORT_RESULT_LEN        18
#define IS3729_SDB_GPIO_ENABLE               1
#define IS3729_SDB_GPIO_DISABLE              0
#define IS3729_I2C_TIMEOUT                  200

extern void mdisplay_is3729_register(int idx);

#ifdef __cplusplus
}
#endif

#endif

